﻿function resetPasswordStart() {
    $("#validationsummary").hide();
    $("#validationsummary").text("");
    if (validate()) {
        $("#validationsummary").hide();
        $("#spinnermsg").text(" Saving...");
        $("#spinnermsg").show();
        $("#spinner").show();
        return true;
    }
    return false;
}

function resetPasswordComplete() {
    if ($("#validationsummary").text() == "") {
        $("#spinnermsg").text("Saved");
        $("#spinnermsg").show();
        if ($("#Url").val() != '') {
            window.location.replace($("#Url").val());
        }
    }
    else {
        $("#validationsummary").show();
    }
}

function validate() {
    if ($("#NewPassword").val() != $("#ConfirmPassword").val()) {
        $("#ConfirmPasswordMessage").text("The confirm password field must match the new password field.");
        $("#ConfirmPasswordMessage").css('color', '#ff0000');
        $("#ConfirmPassword").css('background', '#ffeeee');
        $("#ConfirmPassword").css('border', '1px solid #ff0000');
        return false;
    }
    else {
        return true;
    }
}